<?php
require_once('wpfunctions.php');
header("Content-type: text/plain");
if(!ip_isLoggedIn()) {
  return 'Please log in first.';
}
$name = $_REQUEST['name'];
$text = $_REQUEST['text'];
if(!$name) {
  return "No filename given";
} else if(!$text) {
  return "Cannot save an empty file";
} else if(preg_match('/\.\./','/'.$name)) {
  return "Cannot use .. in the filepath";
}
file_put_contents(ip_createFile($name),$text);
?>